package com.foreveredu.propms.domain;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

/**
 * Description:<br/>
 * 领域模型：物业服务处类<br/>
 * Date:<br/>
 * 2013/3/2<br/>
 * 
 * @author hushigang
 */

@Entity
@Table(name = "T_District")
public class District implements Serializable {

	private static final long serialVersionUID = 1L;
	private int id;
	private String districtId;// 物业服务处编号
	private String name;// 物业服务处名称
	private Set<SubDistrict> subs = new HashSet<SubDistrict>();// 物业服务处管辖的所有小区（建立双向一对多关系）

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@Column
	public String getDistrictId() {
		return districtId;
	}

	public void setDistrictId(String districtId) {
		this.districtId = districtId;
	}

	@Column
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@OneToMany(mappedBy="district")
	@OrderBy(value="id ASC")
	public Set<SubDistrict> getSubs() {
		return subs;
	}

	public void setSubs(Set<SubDistrict> subs) {
		this.subs = subs;
	}
}
